package gameStates.absGamesStates.gui;

import logic.ships.hunter.Hunter;
import main.listeners.listenerClasses.gui.ChatActivatedEvent;
import main.listeners.listenerClasses.gui.ConsoleToggleEvent;
import main.listeners.listenerClasses.gui.GUIListener;
import main.listeners.listenerClasses.gui.IngameChangedEvent;
import main.listeners.listenerClasses.gui.ScoreBoardToggleEvent;
import main.listeners.listenerClasses.gui.SpawnMenuChangedEvent;
import map.spawnStation.SpawnPosition;
import gameStates.gui.GUIState;
import gameStates.passes.AbsPassManagerState;
import interfaces.spawnMenu.AbsSpawnMenu;

public abstract class AbsSpawnState extends GUIState {
	
	public AbsSpawnState(AbsPassManagerState passManagerState, boolean init) {
		super("spawn", passManagerState, init);
		
		addListenerToClearer(new GUIListener() {
			@Override
			public void spawnMenuChanged(SpawnMenuChangedEvent event) {
				setActive(event.getValue());
			}
			
			@Override
			public void scoreBoardToggled(ScoreBoardToggleEvent event) {
				setActive(!event.scoreBoardIsActive() && event.spawnMenuWasActive());
			}
			
			@Override
			public void ingameChanged(IngameChangedEvent event) {
				setActive(event.isIngame() && event.spawnMenuWasActive());
			}
			
			@Override
			public void consoleToggled(ConsoleToggleEvent event) {
				enableInput(!event.getValue());
			}
			
			@Override
			public void chatActivated(ChatActivatedEvent event) {}
		});
	}
	
	public abstract AbsSpawnMenu getSpawnMenu();
	
	public abstract boolean isReady();
	
	public abstract Hunter getSelectedHunter();
	
	public abstract SpawnPosition getSelectedSpawnLocation();
	
	public abstract void showMiniMap();
	
	public abstract boolean isShowingMiniMap();
}